package chapter23

/**
 * Created by alex on 15-4-13.
 */
case class Person(
  name: String,
  isMale: Boolean,
  children: Person*
)

object Run extends App{

  val lara = Person("Lara",false)
  val bob = Person("Bob",false)
  val julie = Person("Julie", false, lara, bob)

  val persons = List(lara, bob, julie)

//  val a = persons filter( p => !p.isMale) flatMap(p => (p.children map (c => (p.name, c.name))))

//  println(a)
//
//  val b = for (p <- persons; if !p.isMale; c <- p.children)
//    yield (p.name, c.name)
//
//  println(b)

//  val a = persons filter(p => !p.isMale) flatMap (p => p.children map (c => (p.name, c.name)))
//  println(a)
}